/* eslint-disable */
export function getBillType(value) {
    var arr = ['J20', 'H20', 'FS', 'FB', 'CS', 'CB201',
        'DS', 'NB', 'SX', 'NP', 'HT', 'TZ', 'BC', 'JS', 'CP'];
    var type = ['借款单', '还款单', '费用申请单', '费用报销单', '出差申请单', '差旅报销单', '电脑申请单',
        '电脑报销单', '事项申请单', '无合同付款单', '合同', '调整合同', '补充合同', '合同结算', '合同付款单'];
    for (var i = 0; i < arr.length; i++) {
        if (value.indexOf(arr[i]) !== -1) {
            return type[i];
        }
    }
};

/**
 * 根据单号获取单据简码
 * @param {*} billNum
 */
export function getJMByBillNum (billNum) {
    if (billNum.indexOf('FB201') > -1) {
      return 'FB'
    } else if (billNum.indexOf('FS201') > -1) {
      return 'FS'
    } else if (billNum.indexOf('SX201') > -1) {
      return 'SX'
    } else if (billNum.indexOf('J201') > -1) {
      return 'JK'
    } else if (billNum.indexOf('HK201') > -1) {
      return 'HK'
    } else if (billNum.indexOf('NB201') > -1) {
      return 'NB'
    } else if (billNum.indexOf('DS201') > -1) {
      return 'DS'
    } else if (billNum.indexOf('CB201') > -1) {
      return 'CB201'
    }  else if (billNum.indexOf('CS201') > -1) {
      return 'CS'
    } else if (billNum.indexOf('CP201') > -1) {
      return 'CP'
    } else if (billNum.indexOf('NP201') > -1) {
      return 'NP'
    } else {
      return ''
    }
  }

  /*
 * 单据简码配置
借款单      JK    例：027DC01J201708050001
还款单      HK    例：027DC01H201708050001
费用申请单  FS   例:027DC01FS201708050001
费用报销单  FB   例：027DC01FB201708050001
出差申请单  CS   例：027DC01CS201708050001
出差报销单  CB201   例：027DC01CB201708050001
电脑申请单  DS   例：027DC01DS201708050001
电脑报销单  NB   例：027DC01NB201708050001
事项申请单  SX   例：027DC01SX201708050001
无合同付款单NP   例：027DC01NP201708050001
合同(战略合同 订单) HT 例：027DC01HT201708050001
调整合同    TZ    例：027DC01FS201708050001TZ01
补充合同    BC    例：027DC01FS201708050001BC01
合同结算    JS    例：027DC01HT201708050001JS01
合同付款单  CP    例：027DC01CP201708050001
*/
export function getBillConfig () {
    return {
      // 申请类
      'FS': {
        title: '费用申请单',
        icon: 'icon-list-feiyongsenqin',
        method: 'getOtherExpenseBills',
        BSID: 'BC_OtherExpense',
        iconText: '费申',
        iconColor: '#'
      },
      'CS': {
        title: '出差申请单',
        icon: 'icon-list-feiyongsenqin',
        method: 'getEvectionReqBills',
        BSID: 'BC_EvectionReq'
      },
      'SX': {
        title: '事项申请单',
        icon: 'icon-list-sixiang',
        method: 'getProjectApprovals',
        BSID: 'CT_ProjectApproval'
      },
      'DS': {
        title: '电脑申请单',
        icon: 'icon-list-diannaosenqin',
        method: 'getcomputerApplications',
        BSID: 'CT_ComputerApplication'
      },
      // 报销类
      'FB_TX': {
        title: '通讯费报销单',
        icon: 'icon-list-tongxun',
        method: 'getBizAccountBills',
        expenseType: 'tel'
      },
      'FB_CL': {
        title: '车辆费报销单',
        icon: 'icon-list-celiang',
        method: 'getBizAccountBills',
        expenseType: 'car'
      },
      'FB_JT': {
        title: '交通费报销单',
        icon: 'icon-list-jiaotong',
        method: 'getBizAccountBills',
        expenseType: 'bus'
      },
      'FB': {
        title: '费用报销单',
        icon: 'icon-list-qitabaoxiao',
        method: 'getBizAccountBills',
        expenseType: 'isIndAmount',
        BSID: 'BC_BizAccount'
      },
      'CB201': {
        title: '差旅报销单',
        icon: 'icon-list-qitabaoxiao',
        method: 'listTravelBillWK',
        BSID: 'BC_TravelAccount'
      },
      'NB': {
        title: '电脑报销单',
        icon: 'icon-list-diannaobaoxiao',
        method: 'getComputerAccounts',
        BSID: 'CT_ComputerAccount'
      },
      'CP': {
        title: '合同付款单',
        icon: 'icon-list-hetongfukuan',
        method: 'getContractPayments'
      },
      'NP': {
        title: '无合同付款单',
        icon: 'icon-list-wuhetongfukuan',
        method: 'getNoContractPayments'
      },
      'JK': {
        title: '借款单',
        icon: 'icon-list-jiekuan',
        method: 'getDailyLoanBills',
        BSID: 'BC_DailyLoan'
      },
      'HK': {
        title: '还款单',
        icon: 'icon-list-jiekuan',
        method: 'getRepaymentBills'
      },
      // 记一笔
      'JYB': {
        title: '记一笔',
        icon: '',
        method: 'getNoteTakings'
      }
    }
  }
